import React, { Fragment } from 'react';

// interface BreadcrumbProps {
//     list: Array<{ label: string; path: string }>;
// }
export default function (props) {

    function createList () {
        return props.list.map((item, i) => {
            return (
                <Fragment key={ i }>
                    { i !== 0 && <span> { props.splitIcon || '/' } </span> }
                    {
                        i === props.list.length - 1
                        ? <span>{ item.label }</span>
                        : <a href={ item.path }>{ item.label }</a>
                    }
                </Fragment>
            );
        });
    }

    return (
        <div className="breadcrumb">
            { createList() }
        </div>
    );
}
